package org.hj.shiro;

import java.util.Set;

/**
 * redisManager interface
 **/

public interface IRedisManager<K, V> {

    /**
     * get value from redis
     *
     * @param key key
     * @return value
     */
    V get(K key);

    /**
     * set value
     *
     * @param key    key
     * @param value  value
     * @param expire expire
     * @return value
     */
    void set(K key, V value, int expire);

    void set(K key, V value);

    boolean hasKey(K key);

    /**
     * del
     *
     * @param key key
     */
    void del(K key);

    /**
     * dbsize
     *
     * @param pattern pattern
     * @return key-value size
     */
    Long dbSize(String pattern);

    /**
     * keys
     *
     * @param pattern key pattern
     * @return key set
     */
    Set<K> keys(String pattern);

    Long scanSize(String key);

    Set<String> scan(String key);
}
